const app = getApp()

import lunar from '../../utils/lunar.js';

Page({
  data: {
    barMarginTop: '16',
    barHeight: '52',
    barWidth: '0',
    scrollHeight: '',
    img_root: app.img_root,
    contactData: [
      {name: '手机', icon: 'iconmobile', value: '13528377187'},
      {name: '微信', icon: 'iconwechat', value: 'junfanlinqq123'},
      {name: '邮箱', icon: 'iconemail', value: 'frankielinster@163.com'},
      // {name: '地址', icon: 'iconlocation', value: '广州白云区江夏北一路'},
    ],
    devSkill: [
      {name: 'vue', icon: 'vue', value: 90},
      {name: 'vue全家桶', icon: 'vueall', value: 90},
      {name: 'vuex', icon: 'vuex', value: 90},
      {name: 'react', icon: 'react', value: 90},
      {name: 'javascrpt', icon: 'js', value: 90},
      {name: 'jQuery', icon: 'jQuery', value: 90},
      {name: '小程序', icon: 'wechatApp', value: 90},
      {name: '公众号', icon: 'wechatWeb', value: 90},
      {name: 'uniapp', icon: 'uniapp', value: 90},
      {name: 'ajax', icon: 'jsAjax', value: 90},
      {name: 'H5', icon: 'html', value: 90},
      {name: 'C3', icon: 'css', value: 90},
      {name: 'git', icon: 'git', value: 90},
      {name: 'elementUI', icon: 'elementUI', value: 90},
      {name: 'vant', icon: 'vant', value: 90},
      {name: 'bootstrap', icon: 'bootstrap', value: 90},
      {name: 'easyUI', icon: 'easyUI', value: 90},
      {name: 'echart', icon: 'echart', value: 90},
      {name: 'sass', icon: 'sass', value: 90},
      {name: 'less', icon: 'less', value: 90},
    ],
    otherSkill: [],
    workList: [
      {
        side: 'right',
        word: '台下人走过 不见旧颜色',
        content: {}
      },
      {
        side: 'left',
        word: '台上人唱着 心碎离别歌',
        content: {}
      }
    ],
    projectList: [
      {
        name: '',
        time: '',
        dec: '',
        charge: [],
        tec: []
      },
      {
        name: '',
        time: '',
        dec: '',
        charge: [],
        tec: []
      }
    ],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (opt) {
    this.getBarHeight()
    this.setListHeight()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    app.setTabBar(this,2)
    this.init()
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},

  /**
   * 设置导航栏高度
   */
  getBarHeight() {
    let systemInfo = wx.getSystemInfoSync()
    let	statusBarHeight = systemInfo.statusBarHeight
    let menu = wx.getMenuButtonBoundingClientRect()

    let	barMarginTop = menu.top
    let	barHeight = menu.height + 10
    let barWidth = systemInfo.windowWidth - (systemInfo.windowWidth - menu.right + menu.width)

    this.setData({
      barMarginTop: barMarginTop,
      barHeight: barHeight,
      barWidth: barWidth
    })
  },

  /**
   * 设置scroll-view高度
   */
  setListHeight() {
    let systemInfo = wx.getSystemInfoSync(),
      rpx = systemInfo.windowWidth / 750, // 计算rpx
      hei = parseInt(this.data.barMarginTop) + parseInt(this.data.barHeight) + 4,
      tapHeight = Math.floor(rpx * hei * 2), // tap高度
      scrollHeight = systemInfo.windowHeight - tapHeight; // swiper高度
    this.setData({
      scrollHeight
    });
  },

  init() {
    let date = lunar.Lunar.fromDate(new Date());
    console.log(date)
  },

  bindDownLoad() {},
})